from chatbot.functionCaller import FunctionResponser
from chatbot.wechatBot import WechatBot
from memoryLib.memoryLib import MemoryLib

if __name__ == '__main__':
    try:
        memoryLib = MemoryLib()
        # ai = chatbot.responser.StreamResponser(characterSetting, "猫娘")
        ai = FunctionResponser(memoryLib.get_character_setting(), "猫娘", memoryLib)
        ai.next("介绍一下你自己吧").speak()

        commandList = ['结束对话', 'getMessageList', '启动微信', '指令']
        commandDescription = f'现在的控制指令有: {commandList}'

        while True:
            # 读取用户输入/
            user_input = input("(输入 结束对话 停止)我说：")

            # 如果用户输入 '结束对话'，则退出循环
            if user_input == "结束对话" or user_input == '0':
                ai.next("拜拜啦").speak()
                break
            if user_input == "getMessageList" or user_input == '2':
                print(ai.get_message_list())
            if user_input == "":
                ai.next("...").speak()
            if user_input == "启动微信" or user_input == '1':
                wechatAi = WechatBot(memoryLib)
                wechatAi.run_listen()
            if user_input == "指令":
                print(commandDescription)
            else:
                # 调用 next 方法获取响应
                ai.next(user_input).speak()
    finally:
        input("按任意键退出...")